<!DOCTYPE html>
<html>
<head>
    <title>设备维护计划</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList && !showPreview">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="4">
                    <i-input v-model="q.planName" @on-enter="query" placeholder="请输入维护计划名称关键字"/>
                </i-col>
                <i-col span="3">
                    <Date-picker type="year" v-model="q.yearly" placeholder="请选择计划实施年份"></Date-picker>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                <i-button type="info" @click="planImplementFollowPreview"><i class="fa fa-tachometer"></i>&nbsp;维护计划实施跟踪 </i-button>
                <i-button type="info" @click="overview"><i class="fa fa-bar-chart"></i>&nbsp;编制设备概览</i-button>
                <i-button type="info" @click="showOrHidePreviewForm"><i class="fa fa-tachometer"></i>&nbsp;维护计划概览
                </i-button>
                <i-button type="info" @click="adjust"><i class="fa fa-adjust"></i>&nbsp;一键排程</i-button>
                <i-button type="info" @click="submitApprove"><i class="fa fa-plus"></i>&nbsp;提交审核</i-button>
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #if($shiro.hasPermission("devAmPlan:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
                #if($shiro.hasPermission("devAmPlan:approve"))
                <i-button type="error" @click="apply"><i class="fa fa-trash-o"></i>&nbsp;审核</i-button>
                #end
            </div>
        </Row>
        <Row  :gutter="16" style="margin: 8px 0px 0px 1px;">
            <i-col :xs="3" :sm="3" :md="3" :lg="3">
                <div class="leftHeight" >
                    <div class="workShop">
                        <p class="text-center" style="font-size: 15px;">工厂/基地</p>
                    </div>
                    <div id="storeLayer" style="margin-top: 25px">
                        <ul id="storeTree" class="ztree"></ul>
                    </div>
                </div>
            </i-col>
            <i-col :xs="21" :sm="21" :md="21" :lg="21">
                <table  id="jqGrid"></table>
            </i-col>
        </Row>
    </div>

    <!-- 维护计划实施操作区域 -->
    <Card v-show="showPreview">
        <p slot="title">维护计划概览区域</p>
        <i-form :label-width="120" :model="overviewParam">
            <Form-item label="计划列表" v-if="selectedPlanList.length > 0">
                {{selectedPlanList}}
            </Form-item>
            <Form-item label="计划年份">
                <Date-picker type="year" v-model="overviewParam.yearly" placeholder="请选择预览年份"></Date-picker>
            </Form-item>
            <Form-item label="操作">
                <i-select v-model="overviewParam.action" placeholder="请选择操作类型" style="width: 200px">
                    <i-option value="onlinePreview">在线预览</i-option>
                    <i-option value="download">下载</i-option>
                </i-select>
            </Form-item>
            <Form-item>
                <i-button type="primary" @click="onlinePreview">提交</i-button>
                <i-button type="warning" @click="showOrHidePreviewForm" style="margin-left: 8px">返回</i-button>
            </Form-item>
        </i-form>
    </Card>
    <!-- 维护计划工单周次选择区域 -->
    <div id="selectWeekOfYearLayer" style="padding: 20px;display: none">
        <i-form>
            <Form-item label="工单周次">
                <Date-picker show-week-numbers v-model="generateMaintenanceTicketDate"
                             placeholder="请选择在第几周生成工单"></Date-picker>
            </Form-item>
        </i-form>
    </div>

    <Card v-show="!showList && !showPreview">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="devPlanMain" :rules="ruleValidate" :label-width="100">
            <Row>
                <i-col span="9">
                    <Form-item label="计划名称" prop="planName">
                        <i-input v-model="devPlanMain.planName" class="form-input"></i-input>
                    </Form-item>
                </i-col>
                <i-col span="8" offset="1">
                    <Form-item label="关联产线" prop="endDate">
                        <i-input type="text" v-model="devPlanMain.devLineName" icon="md-arrow-dropdown-circle"
                                 readonly="readonly"
                                 @on-click="showLine" placeholder="点击选择关联产线"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="9">
                    <Form-item label="计划开始时间" prop="startDate">
                        <Date-picker type="date" v-model="devPlanMain.startDate" class="form-input"></Date-picker>
                    </Form-item>
                </i-col>
                <i-col span="8" offset="1">
                    <Form-item label="计划结束时间" prop="endDate">
                        <Date-picker type="date" v-model="devPlanMain.endDate" class="form-input"></Date-picker>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="9">
                    <Form-item label="排除区间" prop="excludeRange">
                        <Date-picker type="date" multiple show-week-numbers class="form-input"
                                     placeholder="请选择不生成维护工单的周次，可多选" v-model="devPlanMain.excludeRange" @on-change="doHandleExcludeRange"></Date-picker>
                    </Form-item>
                </i-col>
                <i-col span="18">
                    <Form-item label="备注" prop="remark">
                        <i-input type="textarea" v-model="devPlanMain.remark"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>
                返回</i-button>
                <i-button type="info" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
    <!-- 审核表单区域 -->
    <div id="reviewLayer" style="padding: 20px;display: none">
        <i-form :model="approveParam" :label-width="80">
            <Form-item label="审核状态：">
                <Radio-group v-model="approveParam.status">
                    <Radio :label="1"><span>通过</span></Radio>
                    <Radio :label="2"><span>不通过</span></Radio>
                </Radio-group>
            </Form-item>
            <Form-item label="备注：">
                <i-input type="textarea" v-model="approveParam.remark" :rows="3" placeholder="请输入..."></i-input>
            </Form-item>
        </i-form>
    </div>
</div>
<!-- 车间产线选择树 -->
<div id="categoryLayer" style="display: none;padding:10px;">
    <ul id="categoryTree" class="ztree"></ul>
</div>
<script src="${rc.contextPath}/js/device/devAmPlan.js?_${date.systemTime}"></script>
</body>
<style>
    .form-input {
        width: 90%;
        padding-top: 0.5%;
    }
</style>
</html>
